# build bins
APP ?= ""

dev: build-env
	@echo "make dev app: $(APP)" 
	@GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
	go build \
	  -mod vendor \
	  -o $(GOBASE)/build/bin/$(APP) \
	  $(GOBASE)/cmd/$(APP)/main.go		

prod: build-env
	@echo "make prod app: $(APP)" 
	@GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
	go build \
	  -trimpath \
	  -ldflags '-s -w' \
	  -mod vendor \
	  -o $(GOBASE)/build/bin/$(APP) \
	  $(GOBASE)/cmd/$(APP)/main.go	

clean:
	rm -f $(GOBASE)/build/bin/*

build-env:
ifeq ($(APP), "")
	@echo "error -> please set app first, eg: APP=agent"
	@exit 1
endif